package com.steakliu.sun.protocol.context;

import com.steakliu.sun.protocol.future.SunFuture;

/**
 * 功能说明： 异步结果上下文
 * <p>
 * Original @Author: steakliu-刘牌, 2023-01-11  21:12
 * <p>
 * Copyright (C)2020-2022  steakliu All rights reserved.
 */
public class RpcContext {

    private static final InheritableThreadLocal<SunFuture> THREAD_LOCAL_FUTURE = new InheritableThreadLocal<>();

    public static void setContext(SunFuture sunFuture){
        THREAD_LOCAL_FUTURE.set(sunFuture);
    }

    public static SunFuture getContext(){
        return THREAD_LOCAL_FUTURE.get();
    }

    public static void remove(){
        THREAD_LOCAL_FUTURE.remove();
    }
}
